﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Comp376A2_9609695
{
    /// <summary>
    /// The main menu
    /// </summary>
    class MainMenu : Drawable
    {
        public SpriteSheet spritesheet;
        public Vector2 position;
        private SpriteFont font;
        private Score highScore;

        /// <summary>
        /// MainMenu takes in all of the objects it must have
        /// </summary>
        /// <param name="spritesheet">The sprite sheet to use</param>
        /// <param name="font">The sprite font to use</param>
        /// <param name="highScore">The score object to use</param>
        public MainMenu(SpriteSheet spritesheet, SpriteFont font, Score highScore)
        {
            this.spritesheet = spritesheet;
            this.font = font;
            this.highScore = highScore;
            position = new Vector2();
        }

        public Texture2D getImage()
        {
            return spritesheet.image;
        }

        public void draw(SpriteBatch renderer)
        {
            int logoInd = spritesheet.getAnimation("logo").First();
            Rectangle logo = spritesheet.getSprite(logoInd);

            int pointerInd = spritesheet.getAnimation("pointer").First();
            Rectangle pointer = spritesheet.getSprite(pointerInd);

            renderer.Draw(spritesheet.image, new Vector2(position.X + 56, (int)position.Y + 48), logo, Color.White);
            if (position.Y == 0)
                renderer.Draw(spritesheet.image, new Vector2(position.X + 76, (int)position.Y + 112), pointer, Color.White);

            renderer.DrawString(font, "HI-SCORE", new Vector2(position.X + 96, (int)position.Y + 16), new Color(181, 49, 32));
            renderer.DrawString(font, "START GAME", new Vector2(position.X + 96, (int)position.Y + 112), new Color(181, 49, 32));
            highScore.position = new Vector2(position.X + 152, position.Y + 25);
            highScore.draw(renderer);
        }
    }
}
